#include "main.h"

static double prevData=0;
static double p=10, r=0.01, kGain=0;

double kalmanFilter(double inData)
{
	double q = temp_pid/200;

	p = p + q;
	kGain = p/(p+r);

	inData = prevData+(kGain*(inData-prevData));
	p = (1-kGain)*p;

	prevData = inData;

	return inData;
}
